' T%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%W%
 
 ' Q%          N a m e :   T - J o i n _ E a r l y _ 0 7 . t x t                       D a t e :   2 0   D e c   2 0 2 4   Q%
 
 ' Q%      A u t h o r :   L e o n a r d o                                                                                 Q%
 
 ' Q%        S c o p e :   N e w   g e a r e d   r e d u c t i o n ,   D C   m o t o r ,   H a l l   e n c o d e r         Q%
 
 ' `%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%c%
 
 ' Q%H a r d w a r e :   L 9 1 1 0 s - H _ M O S F E T   2   m o t o r   d r i v e r s                                     Q%
 
 ' Q%                    J G Y _ 3 7 0 _ M o t o r _ r e d u c t i o n                                                     Q%
 
 ' Q%                    M T 6 7 1 0   o n l y   a n a l o g                                                               Q%
 
 ' _% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %b%
 
 ' Q%        N o t e :   F i r s t   r u n                                             D a t e :   1 5   D e c   2 0 2 4   Q%
 
 ' Q%                                                                                                                      Q%
 
 ' Z%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%]%
 
 O p t i o n   S p e e d   9 
 
 L o a d   i m a g e s \ G e a r e d _ m o t o r _ r e d u c t i o n . j p g 
 
 ' B e e p   " 2 5 0 0   2 0 0 ,   1 5 0 0   2 0 0 " 
 
 T T S   S e l e c t V o i c e   " E N G " 
 
 ' T T S   S e l e c t V o i c e   " Z H O " 
 
 T T S   S e t V o l u m e   1 0 0             ' 1 0 0 
 
 ' T T S   S e t S p e e d   - 1 
 
 T T S   S p e a k   " R u n " 
 
 
 
 '   T%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%W%
 
 '   Q%  S L O T   T E X T   f o r   C O M M A N D S   a n d   R E S P O N S E S               Q%
 
 '   Z%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%]%
 
 N u m e r i c   S l o t _ C o m m a n d s T o C o b o t         =   5 1 
 
 N u m e r i c   S l o t _ R e s p o n s e s F r o m C o b o t   =   5 2 
 
 N u m e r i c   S l o t _ E x t e r n a l C o m m a n d s       =   5 3 
 
 
 
 '   T%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%W%  %%%%  %      %%%%  %%%%%
 
 '   Q%  S L O T   I N I T I A L I Z A T I O N S   &   V A R I A B L E                         Q%  %%%%  %      %    %      %
 
 '   Z%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%]%  %%%%  %%%  %%%%      %
 
 N u m e r i c   S l o t _ M o t o r A _ A           =     1 
 
 N u m e r i c   S l o t _ M o t o r A _ B           =     2 
 
 N u m e r i c   S l o t _ A n a l o g A n g l e     =     6 
 
 N u m e r i c   S l o t _ L e d R                   =     7 
 
 N u m e r i c   S l o t _ L e d G                   =     8 
 
 N u m e r i c   S l o t _ L e d B                   =     9 
 
 N u m e r i c   S l o t _ S i g n a l S c o p e     =   1 3 
 
 
 
 N u m e r i c   S l o t _ D e s t 1                 =   1 0 1 
 
 N u m e r i c   S l o t _ P o s 1                   =   1 0 2 
 
 
 
 N u m e r i c   S l o t _ M a s t e r S t a t u s   =   9 0 8 
 
 
 
 '   T%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%W%  %%%%  %    %  %%%%%  %%%%%  %%%%  %%  %  %%%%
 
 '   Q%  B U T T O N S                                                       Q%  %%%%  %    %      %          %      %    %  %  %%  %%%%
 
 '   Z%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%]%  %%%%  %%%%      %          %      %%%%  %    %  %%%%
 
 B u t t o n     1   L a b e l   H O M E 
 
 B u t t o n   H O M E   C o l o r   P a l e T u r q u o i s e 
 
 
 
 B u t t o n     2   L a b e l   C C W 
 
 B u t t o n     3   L a b e l   C W 
 
 B u t t o n     4   L a b e l   A L T 
 
 B u t t o n     8   L a b e l   G o T o 5 
 
 B u t t o n     9   L a b e l   G o T o 1 0 0 
 
 B u t t o n   1 0   L a b e l   G o T o 2 0 0 
 
 B u t t o n   1 1   L a b e l   G o T o 3 5 5 
 
 B u t t o n   1 2   L a b e l   P I D T e s t 
 
 
 
 
 
 ' B u t t o n   8   L a b e l   I n p u t P o s i t i o n 
 
 ' B u t t o n   I n p u t P o s i t i o n   T e x t   " I n p u t   P o s i t i o n " 
 
 ' B u t t o n   I n p u t P o s i t i o n   C o l o r   G r e e n Y e l l o w 
 
 
 
 ' B u t t o n   6   L a b e l   E t n T e s t 
 
 ' B u t t o n   E t n T e s t   T e x t   " E t n   T e s t " 
 
 ' B u t t o n   E t n T e s t   C o l o r   G o l d 
 
 ' 
 
 ' B u t t o n   7   L a b e l   D i s a b l e M o t o r 
 
 ' B u t t o n   D i s a b l e M o t o r   T e x t   " D I S A B L E   M O T O R " 
 
 ' B u t t o n   D i s a b l e M o t o r   C o l o r   P a l e T u r q u o i s e 
 
 ' 
 
 ' B u t t o n   8   L a b e l   E n a b l e M o t o r 
 
 ' B u t t o n   E n a b l e M o t o r   T e x t   " E N A B L E   M O T O R " 
 
 ' B u t t o n   E n a b l e M o t o r   C o l o r   P a l e T u r q u o i s e 
 
 
 
 ' B u t t o n   9   L a b e l   R e d O n 
 
 ' B u t t o n   R e d O n   C o l o r   R e d 
 
 ' B u t t o n   1 0   L a b e l   G r e e n O n 
 
 ' B u t t o n   G r e e n O n   C o l o r   G r e e n 
 
 ' B u t t o n   1 1   L a b e l   Y e l l o w O n 
 
 ' B u t t o n   Y e l l o w O n   C o l o r   Y e l l o w 
 
 ' B u t t o n   1 2   L a b e l   B l u e O n 
 
 ' B u t t o n   B l u e O n   C o l o r   M e d i u m B l u e 
 
 ' B u t t o n   1 3   L a b e l   W h i t e O n 
 
 ' B u t t o n   G r e e n O n   C o l o r   G r e e n 
 
 ' B u t t o n   1 4   L a b e l   R g b O f f 
 
 ' B u t t o n   R g b O f f   C o l o r   B l a c k 
 
 
 
 
 
 B u t t o n   1 5   L a b e l   C l o s e A l l 
 
 B u t t o n   C l o s e A l l   T e x t   " C L O S E   A L L " 
 
 B u t t o n   C l o s e A l l   C o l o r   R e d 
 
 
 
 D i s a b l e A l l B u t t o n s 
 
 
 
 '   T%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%W%  %      %%%%  %%%%  %%%%
 
 '   Q%  L O A D   A P P S                                                                     Q%  %      %    %  %%%%  %    %
 
 '   Z%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%]%  %%%  %%%%  %    %  %%%%
 
 L o a d   T h e r e m i n o _ H A L . e x e 
 
 L o a d   T h e r e m i n o _ S l o t V i e w e r . e x e 
 
 L o a d   T h e r e m i n o _ S i g n a l S c o p e . e x e 
 
 L o a d   T h e r e m i n o _ C o b o t . e x e 
 
 
 
 '   T%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%W%      %%%%%    %%%%%    %%%%%    %%%%%    %%%%%
 
 '   Q%    E X E C U T I O N   S T A R T   F R O M   H E R E             Q%      %%%%%        %        %%%%%    %%%%%        %
 
 '   Z%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%]%      %%%%%        %        %      %    %    %%        %
 
 Y e l l o w O n 
 
 L o a d   H i d e 
 
 C o n t r o l s   C l e a r T e x t B o x 
 
 A L T 
 
 Y e l l o w O n 
 
 E n a b l e A l l B u t t o n s 
 
 S l o t ( S l o t _ S i g n a l S c o p e )   =   1 0 0 0 
 
 S l o t   0   =   R e c o g n i z e 
 
 G o T o 5 
 
 P I D T e s t 
 
 
 
 L o o p 
 
 S t o p 
 
 
 
 ' L a b e l   E v e n t T i m e r 
 
 ' 	 I f   R i g h t ( D e c o d e C o m m a n d S l o t ( 0 ) ,   5 )   =   " E R R O R " 
 
 ' 	 	 P r i n t   D e c o d e C o m m a n d S l o t ( 0 ) 
 
 ' 	 	 T T S   S p e a k   " M a s t e r   e r r o r " 
 
 ' 	 	 A L T 
 
 ' 	 	 E n d 
 
 ' 	 E n d I f 
 
 ' R e t u r n 
 
 
 
 '   T%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%W%  %      %%%%  %%%%  %%%%
 
 '   Q%  L O O P                                                                               Q%  %      %    %  %    %  %%%%
 
 '   Z%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%]%  %%%  %%%%  %%%%  %
 
 L a b e l   L o o p 
 
 	 E x e c u t e P I D 
 
 	 S l o t ( S l o t _ P o s 1 )   =   S l o t ( S l o t _ A n a l o g A n g l e ) 
 
 	 W a i t   S e c o n d s   0 . 0 1 
 
 G o t o   L o o p 
 
 
 
 '   T%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%W%
 
 '   Q%  S T A T U S   M A S T E R   Q U E R Y                                                 Q%
 
 '   Z%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%]%
 
 L a b e l   S t a t u s M a s t e r 
 
 	 S t r i n g   M a s t e r 
 
 	 I f   S l o t ( S l o t _ M a s t e r S t a t u s )   < >   1 0 0 0 
 
 	 	 M a s t e r   =   " O F F " 
 
 	 	 P r i n t   " M A S T E R   O F F     " 
 
 	 	 W a i t   S e c o n d s   0 . 2 
 
 	 E l s e 
 
 	 	 M a s t e r   =   " O N " 
 
 	 	 ' P r i n t   " M A S T E R   O N     " 
 
 	 E n d I f 
 
 R e t u r n 
 
 
 
 '   T%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%W%
 
 '   Q%  E N A B L E / D I S A B L E   B U T T O N S                                           Q%
 
 '   Z%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%]%
 
 L a b e l   E n a b l e A l l B u t t o n s 
 
 	 F o r   v 1   =   1   T o   1 6 
 
 	 	 B u t t o n   v 1   E n a b l e d 
 
 	 N e x t 
 
 R e t u r n 
 
 
 
 L a b e l   D i s a b l e A l l B u t t o n s 
 
 	 F o r   v 1   =   1   T o   1 6 
 
 	 	 B u t t o n   v 1   D i s a b l e d 
 
 	 N e x t 
 
 R e t u r n 
 
 
 
 '   T%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%W%
 
 '   Q%    W A I T   C O B O T   R E A D Y                                                     Q%
 
 '   Z%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%]%
 
 L a b e l   W a i t C o b o t R e a d y 
 
 	 N u m e r i c   W C R 1 
 
 	 F o r   W C R 1   =   1   T o   I n f i n i t y 
 
 	 	 W a i t   S e c o n d s   0 . 0 5 
 
 	 	 I f   S l o t T e x t ( S l o t _ R e s p o n s e s F r o m C o b o t )   =   " R e a d y " 
 
 	 	 	 E x i t 
 
 	 	 E n d I f 
 
 	 N e x t 
 
 R e t u r n 
 
 
 
 '   T%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%W%  %%%%  %%%%%  %%%%  %%%%
 
 '   Q%  S T O P   E V E N T   ( w h e n   p r e s s i n g   s t o p   b u t t o n )           Q%  %%%%      %      %    %  %%%%
 
 '   Z%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%]%  %%%%      %      %%%%  %
 
 L a b e l   E v e n t S t o p 
 
 	 A L T 
 
 	 R e d O n 
 
 	 E n a b l e A l l B u t t o n s 
 
 	 G o T o 5 
 
 	 W i n d o w   S i z a b l e 
 
 	 S l o t ( S l o t _ S i g n a l S c o p e )   =   0 
 
 E n d 
 
 
 
 '   T%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%W%  %%%  %      %%%%  %%%%  %%%%
 
 '   Q%  C L O S E   A L L             ( w h e n   p r e s s i n g   X   o n   f o r m )       Q%  %      %      %    %  %%%%  %%%
 
 '   Z%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%]%  %%%  %%%  %%%%  %%%%  %%%%
 
 L a b e l   C l o s e A l l 
 
 	 A L T 
 
 	 R e d O n 
 
 	 G o T o 5 
 
 R e t u r n 
 
 
 
 '   = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 '     S E N D   C O M M A N D   ( d e f a u l t   t i m e o u t   =   0 . 5   S e c ) 
 
 '   = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 L a b e l   S e n d C o m m a n d 	 	 	 ' ( D e s t i n a t i o n   S l o t ) ( C o m m a n d   S t r i n g ) 
 
 	 N u m e r i c   S C 1 
 
 	 S t r i n g     S C 2 
 
 	 N u m e r i c   S C 3   =   0 . 7   ' < - -   T h e   t i m e o u t   i n   s e c o n d s   w a s   0 . 5 
 
 	 N u m e r i c   S C 4 
 
 	 S l o t T e x t   S C 1   =   S C 2 
 
 	 F o r   S C 4   =   0 . 1   T o   S C 3   S t e p   0 . 1 
 
 	 	 I f   S l o t T e x t ( S C 1 )   =   " " 
 
 	 	 	 E x i t 
 
 	 	 E n d I f 
 
 	 	 W a i t   S e c o n d s   0 . 1 
 
 	 N e x t 
 
 R e t u r n 
 
 
 
 L a b e l   C l e a r C o m m a n d 
 
 	 S l o t T e x t ( S l o t _ E x t e r n a l C o m m a n d s )   =   " " 
 
 R e t u r n 
 
 
 
 ' T%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%W%
 
 ' Q%C O M M A N D S   T O   C O B O T Q%
 
 ' Z%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%]%
 
 '   %%%%  %%%%  %%  %%  %%  %%      %%%%%  %%%%      %%%%  %%%%  %%%    %%%%  %%%%%
 
 '   %        %    %  %  %  %  %  %  %          %      %    %      %        %    %  %%%%  %    %      %
 
 '   %%%%  %%%%  %      %  %      %  %      %      %%%%      %%%%  %%%%  %%%%  %%%%      %
 
 
 
 L a b e l   E x e c C o b o t 
 
 	 S e n d C o m m a n d ( S l o t _ C o m m a n d s T o C o b o t ) ( " D i s a b l e R e p e a t " ) 
 
 	 S e n d C o m m a n d ( S l o t _ C o m m a n d s T o C o b o t ) ( " S e l e c t L i n e   1 " ) 
 
 	 S e n d C o m m a n d ( S l o t _ C o m m a n d s T o C o b o t ) ( " S t a r t E x e c u t i o n " ) 
 
 R e t u r n 
 
 
 
 L a b e l   S t o p C o b o t 
 
 	 S e n d C o m m a n d ( S l o t _ C o m m a n d s T o C o b o t ) ( " S t o p E x e c u t i o n " ) 
 
 R e t u r n 
 
 
 
 L a b e l   A r r o w U p C o b o t 
 
 	 S e n d C o m m a n d ( S l o t _ C o m m a n d s T o C o b o t ) ( " A r r o w U p " ) 
 
 R e t u r n 
 
 
 
 L a b e l   A r r o w D o w n C o b o t 
 
 	 S e n d C o m m a n d ( S l o t _ C o m m a n d s T o C o b o t ) ( " A r r o w D o w n " ) 
 
 R e t u r n 
 
 
 
 L a b e l   E x e c u t e C o b o t F r o m S e l e c t e d L i n e 
 
 	 S e n d C o m m a n d ( S l o t _ C o m m a n d s T o C o b o t ) ( " S t a r t E x e c u t i o n " ) 
 
 R e t u r n 
 
 
 
 L a b e l   C o r r e c t S e l e c t e d P o s i t i o n 
 
 	 I f   M a s t e r   =   " O F F " 
 
 	 	 R e t u r n 
 
 	 E n d I f 
 
 	 S e n d C o m m a n d ( S l o t _ C o m m a n d s T o C o b o t ) ( " C o r r e c t S e l e c t e d P o s i t i o n " ) 
 
 R e t u r n 
 
 
 
 L a b e l   D e l e t e S e l e c t e d L i n e 
 
 	 S e n d C o m m a n d ( S l o t _ C o m m a n d s T o C o b o t ) ( " D e l e t e S e l e c t e d L i n e " ) 
 
 R e t u r n 
 
 
 
 L a b e l   A d d N e w P o s i t i o n 
 
 	 S e n d C o m m a n d ( S l o t _ C o m m a n d s T o C o b o t ) ( " A d d N e w P o s i t i o n " ) 
 
 R e t u r n 
 
 
 
 L a b e l   E n a b l e R e p e a t 
 
 	 S e n d C o m m a n d ( S l o t _ C o m m a n d s T o C o b o t ) ( " E n a b l e R e p e a t " ) 
 
 R e t u r n 
 
 
 
 L a b e l   D i s a b l e R e p e a t 
 
 	 S e n d C o m m a n d ( S l o t _ C o m m a n d s T o C o b o t ) ( " D i s a b l e R e p e a t " ) 
 
 R e t u r n 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 '   T%P%P%P%P%P%P%P%P%P%P%P%P%W%  %%%%  %%%%  %%%%%  %  %%%%  %%  %  %%%%
 
 '   Q%    A c t i o n s       Q%  %%%%  %            %      %  %    %  %  %%  %%%%
 
 '   Z%P%P%P%P%P%P%P%P%P%P%P%P%]%  %    %  %%%%      %      %  %%%%  %    %  %%%%
 
 L a b e l   C C W                                               ' d o w n 
 
 	 A L T 
 
 	 S l o t ( S l o t _ M o t o r A _ A )         =   0 
 
 	 S l o t ( S l o t _ M o t o r A _ B )         =   1 0 0 0 0 
 
 R e t u r n 
 
 
 
 L a b e l   C W                                               ' u p 
 
 	 A L T 
 
 	 S l o t ( S l o t _ M o t o r A _ A )         =   1 0 0 0 
 
 	 S l o t ( S l o t _ M o t o r A _ B )         =   0 
 
 R e t u r n 
 
 
 
 L a b e l   A L T 
 
 	 S l o t ( S l o t _ M o t o r A _ A )         =   1 0 0 0 
 
 	 S l o t ( S l o t _ M o t o r A _ B )         =   1 0 0 0 
 
 	 W a i t   S e c o n d s   0 . 1 
 
 	 S l o t ( S l o t _ M o t o r A _ A )         =   0 
 
 	 S l o t ( S l o t _ M o t o r A _ B )         =   0 
 
 	 W a i t   S e c o n d s   0 . 5 
 
 R e t u r n 
 
 
 
 L a b e l   G o T o 5 
 
 	 S l o t ( S l o t _ D e s t 1 )   =   5 
 
 R e t u r n 
 
 
 
 L a b e l   G o T o 1 0 0 
 
 	 S l o t ( S l o t _ D e s t 1 )   =   1 0 0 
 
 R e t u r n 
 
 
 
 L a b e l   G o T o 2 0 0 
 
 	 S l o t ( S l o t _ D e s t 1 )   =   2 0 0 
 
 R e t u r n 
 
 
 
 L a b e l   G o T o 3 5 5 
 
 	 S l o t ( S l o t _ D e s t 1 )   =   3 5 5 
 
 R e t u r n 
 
 
 
 '   T%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%W%
 
 '   Q%  H O M E   S E T                                                                       Q%
 
 '   Z%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%]%
 
 L a b e l   H O M E 
 
 	 N u m e r i c   H o 1 
 
 	 N u m e r i c   S H 1 
 
 	 F o r   H o 1   =   1   T o   I n f i n i t y 
 
 	 	 S H 1   =   S l o t ( S l o t _ A n a l o g A n g l e ) 
 
 	 	 S l o t ( S l o t _ M o t o r A _ A )         =   0 
 
 	 	 S l o t ( S l o t _ M o t o r A _ B )         =   1 0 0 
 
 	 	 I f   S H 1   < =   1 5 
 
 	 	 	 E x i t 
 
 	 	 E n d I f 
 
 	 	 W a i t   S e c o n d s   0 . 1 
 
 	 N e x t 
 
 	 A L T 
 
 R e t u r n 
 
 
 
 '   T%P%P%P%P%P%P%P%P%P%P%P%P%W%  %%%%  %%%%  %%%%%  %  %%%%  %%  %  %%%%
 
 '   Q%    A c t i o n s       Q%  %%%%  %            %      %  %    %  %  %%  %%%%
 
 '   Z%P%P%P%P%P%P%P%P%P%P%P%P%]%  %    %  %%%%      %      %  %%%%  %    %  %%%%
 
 L a b e l   P I D T e s t 
 
 	 I f   M a s t e r   =   " O F F " 
 
 	 	 R e t u r n 
 
 	 E n d I f 
 
 	 T T S   S p e a k W a i t   " P i d   t e s t " 
 
 	 S e n d C o m m a n d ( S l o t _ C o m m a n d s T o C o b o t ) ( " E n a b l e R e p e a t " ) 
 
 	 S e n d C o m m a n d ( S l o t _ C o m m a n d s T o C o b o t ) ( " L o a d S e q u e n c e   T - P I D _ T e s t . t x t " ) 
 
 	 S e n d C o m m a n d ( S l o t _ C o m m a n d s T o C o b o t ) ( " S e l e c t L i n e   1 " ) 
 
 	 S e n d C o m m a n d ( S l o t _ C o m m a n d s T o C o b o t ) ( " S t a r t E x e c u t i o n " ) 
 
 R e t u r n 
 
 
 
 L a b e l   N a i l s E N 
 
 	 I f   M a s t e r   =   " O F F " 
 
 	 	 R e t u r n 
 
 	 E n d I f 
 
 	 T T S   S p e a k W a i t   " G o t o   H o m e . " 
 
 	 S e n d C o m m a n d ( S l o t _ C o m m a n d s T o C o b o t ) ( " D i s a b l e R e p e a t " ) 
 
 	 S e n d C o m m a n d ( S l o t _ C o m m a n d s T o C o b o t ) ( " L o a d S e q u e n c e   T W e l d _ N a i l s E N . t x t " ) 
 
 	 S e n d C o m m a n d ( S l o t _ C o m m a n d s T o C o b o t ) ( " S e l e c t L i n e   1 " ) 
 
 	 ' S e n d C o m m a n d ( S l o t _ C o m m a n d s T o C o b o t ) ( " S t a r t E x e c u t i o n " ) 
 
 R e t u r n 
 
 
 
 
 
 
 
 
 
 
 
 '   T%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%W%  %%%%  %  %%%%
 
 '   Q%    P I D                                             Q%  %%%%  %  %    %
 
 '   Z%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%]%  %        %  %%%%
 
 V a r i a b l e   N u m e r i c   P i d K P   =   7 0 
 
 V a r i a b l e   N u m e r i c   P i d K I   =   1 0 
 
 V a r i a b l e   N u m e r i c   P i d K D   =   1 0 
 
 
 
 ' 7 0   5 0   1 0   f o r   6 V 
 
 ' 7 0   1 0   1 0   f o r   1 0 
 
 
 
 V a r i a b l e   N u m e r i c   P i d P 
 
 V a r i a b l e   N u m e r i c   P i d I 
 
 V a r i a b l e   N u m e r i c   P i d D 
 
 V a r i a b l e   N u m e r i c   P i d E r r 
 
 V a r i a b l e   N u m e r i c   P i d N e w T i m e 
 
 V a r i a b l e   N u m e r i c   P i d O l d T i m e 
 
 V a r i a b l e   N u m e r i c   P i d L o o p T i m e 
 
 V a r i a b l e   N u m e r i c   P i d O l d D 
 
 
 
 N u m e r i c   D r i v e 1 
 
 
 
 L a b e l   E x e c u t e P I D 
 
 	 '   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -   L o o p   t i m e 
 
 	 P i d N e w T i m e   =   E l a p s e d T i m e 
 
 	 P i d L o o p T i m e   =   P i d N e w T i m e   -   P i d O l d T i m e 
 
 	 P i d O l d T i m e   =   P i d N e w T i m e 
 
 	 '   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -   E r r o r 
 
 	 P i d E r r   =   S l o t ( S l o t _ D e s t 1 )   -   S l o t ( S l o t _ P o s 1 ) 
 
 	 '   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -   P 
 
 	 P i d P   =   P i d K P   *   P i d E r r 
 
 	 '   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -   I 
 
 	 I f   A b s ( P i d E r r )   <   1 5 0 0 0   A n d   P i d E r r   >   0 . 0 1 
 
 	 	 P i d I   =   P i d I   +   P i d E r r   *   P i d L o o p T i m e 
 
 	 E l s e 
 
 	 	 P i d I   =   0 
 
 	 E n d I f 
 
 	 '   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -   D   ( b a s e d   o n   E r r ) 
 
 	 P i d D   =   ( P i d E r r   -   P i d O l d D )   /   P i d L o o p T i m e 
 
 	 P i d O l d D   =   P i d E r r 
 
 	 '   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -   O u t p u t 
 
 	 D r i v e 1   =   P i d P   +   P i d K I   *   P i d I   +   P i d K D   *   P i d D 
 
 	 
 
 	 I f   D r i v e 1   >   0 
 
 	 	 S l o t ( S l o t _ M o t o r A _ A )   =   0 
 
 	 	 S l o t ( S l o t _ M o t o r A _ B )   =   A b s ( D r i v e 1 ) 
 
 	 E l s e 
 
 	 	 S l o t ( S l o t _ M o t o r A _ B )   =   0 
 
 	 	 S l o t ( S l o t _ M o t o r A _ A )   =   A b s ( D r i v e 1 ) 
 
 	 E n d I f 
 
 R e t u r n 
 
 
 
 '   T%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%W%  %      %%%  %%%
 
 '   Q%  L E D   C O L O R S                     Q%  %      %%    %    %
 
 '   Z%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%]%  %%%  %%%  %%%%
 
 L a b e l   R e d O n 
 
 	 S l o t   S l o t _ L e d R   =   1 0 0 0 
 
 	 S l o t   S l o t _ L e d G   =   0 
 
 	 S l o t   S l o t _ L e d B   =   0 
 
 R e t u r n 
 
 
 
 L a b e l   M a g e n t a O n 
 
 	 S l o t   S l o t _ L e d R   =   1 0 0 0 
 
 	 S l o t   S l o t _ L e d G   =   0 
 
 	 S l o t   S l o t _ L e d B   =   1 0 0 0 
 
 R e t u r n 
 
 
 
 L a b e l   Y e l l o w O n 
 
 	 S l o t   S l o t _ L e d R   =   9 0 0 
 
 	 S l o t   S l o t _ L e d G   =   4 0 0 
 
 	 S l o t   S l o t _ L e d B   =   0 
 
 R e t u r n 
 
 
 
 L a b e l   G r e e n O n 
 
 	 S l o t   S l o t _ L e d R   =   0 
 
 	 S l o t   S l o t _ L e d G   =   1 0 0 0 
 
 	 S l o t   S l o t _ L e d B   =   0 
 
 R e t u r n 
 
 
 
 L a b e l   B l u e O n 
 
 	 S l o t   S l o t _ L e d R   =   0 
 
 	 S l o t   S l o t _ L e d G   =   0 
 
 	 S l o t   S l o t _ L e d B   =   1 0 0 0 
 
 R e t u r n 
 
 
 
 L a b e l   W h i t e O n 
 
 	 S l o t   S l o t _ L e d R   =   1 0 0 0 
 
 	 S l o t   S l o t _ L e d G   =   1 0 0 0 
 
 	 S l o t   S l o t _ L e d B   =   1 0 0 0 
 
 R e t u r n 
 
 
 
 L a b e l   R g b O f f 
 
 	 S l o t   S l o t _ L e d R   =   0 
 
 	 S l o t   S l o t _ L e d G   =   0 
 
 	 S l o t   S l o t _ L e d B   =   0 
 
 R e t u r n 
 
 
 
 L a b e l   R e d B l i n k 
 
 	 R e d O n 
 
 	 W h i t e O n 
 
 R e t u r n 
 
 
 
 '   T%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%W%
 
 '   Q%  P R I N T   C O O R D I N A T E S                                                     Q%
 
 '   Z%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%]%
 
 L a b e l   P r i n t V a l u e s 
 
 	 C o n t r o l s   O p e n T e x t B o x 
 
 	 s 1   =               " D e s t . = "   +   F o r m a t ( S l o t ( S l o t _ M o t o r A _ B ) ,   " 0 . 0 0 0 " ) 
 
 	 P r i n t   C R L F   +   s 1 
 
 R e t u r n 
 
 
 
 '   T%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%W%  %%%%%  %%%%  %  %%%%  %
 
 '   Q%  T   R   I   A   L   S                                                                 Q%      %      %%%%  %  %%%%  %
 
 '   Z%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%]%      %      %  %%  %  %    %  %%%
 
 
 
 '   T%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%W%  %%%%  %    %  %%%
 
 '   Q%    S   U   B   R   O   U   T   I   N   E       A   R   E   A                           Q%  %%%%  %    %  %%%%
 
 '   Z%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%]%  %%%%  %%%%  %%%%
 
 
 
 
 
 
 
 
 
 ' B O O K M A R K S   3 7 4   
 
 
 
 ' E D I T E D L I N E S   5 8   1   5 6   1   5 7   2   3 4 8   3   1 1 7   4   1 8 9   5   2 0 0   6   3 7 4   9   3 7 3   9   3 7 8   9   3 7 5   1 0   
 
 
 
 ' W A T C H   t t s v o i c e s 
 
 ' W A T C H   S 1 
 
 